<?php
declare (strict_types=1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Blog extends Model
{
    protected $table = 'ctmon_blog';
    protected $pk = 'article_id';

    protected $schema = [
        'article_id' => 'int',
        'cat_id' => 'int',
        'title' => 'varchar',
        'fu_title' => 'varchar',
        'title_style' => 'varchar',
        'content' => 'longtext',
        'content2' => 'longtext',
        'author' => 'varchar',
        'source' => 'varchar',
        'editor' => 'varchar',
        'is_top' => 'bit',
        'is_best' => 'bit',
        'is_hot' => 'bit',
        'info_tlp' => 'varchar',
        'is_show' => 'bit',
        'tag' => 'varchar',
        'is_newopen' => 'bit',
        'link' => 'varchar',
        'photo' => 'varchar',
        'photo2' => 'varchar',
        'des' => 'text',
        'urlrewriter' => 'varchar',
        'add_time' => 'timestamp',
        'showtime' => 'timestamp',
        'click_count' => 'int',
        'pagetitle' => 'text',
        'pagekeywords' => 'text',
        'pagedesc' => 'text',
        'sort_order' => 'int',
        'is_mobile' => 'bit',
        'is_oauth' => 'bit',
        'cms_type' => 'int',
        'down_id' => 'text',
        'is_sinas' => 'int',
        'is_toutiao' => 'int',
        'is_xiongzhang' => 'int',
        'csh_id' => 'int',
        'csh_id2' => 'int',
        'csh_id3' => 'int',
    ];

    public function getSchema(): array
    {
        return $this->schema;
    }

    /**
     * 文章分类
     * @return \think\model\relation\HasOne
     */
    public function category()
    {
        return $this->hasOne(Blogcat::class, 'cat_id', 'cat_id');
    }
}
